Skip to content

Adjust ManagedType implementation and spec#15356

Open
Youssef1313 wants to merge 3 commits into
mainfrom
dev/ygerges/managedtype
Open

Adjust ManagedType implementation and spec#15356
Youssef1313 wants to merge 3 commits into
mainfrom
dev/ygerges/managedtype

Conversation

@Youssef1313

Copy link
Copy Markdown
Member

Description

Please add a meaningful description for this change.
Ensure the PR has required unit tests.

Related issue

Kindly link any related issues. E.g. Fixes #xyz.

  • I have ensured that there is a previously discussed and approved issue.

@nohwnd

nohwnd commented May 13, 2026

Copy link
Copy Markdown
Member

Youssef do you still remember the details of why this change is needed here? And what is the impact of it on existing integrations.

Copilot AI review requested due to automatic review settings May 13, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ManagedName utilities and the corresponding RFC to change how ManagedType is represented and resolved (moving away from an escaped identifier form toward using the raw CLR metadata type name).

Changes:

  • ManagedNameHelper.GetManagedName* now sets managedTypeName from Type.FullName and adjusts hierarchy extraction to use the type-builder string.
  • ManagedNameHelper.GetMethod no longer unescapes managedTypeName before calling Assembly.GetType.
  • RFC 0017 is updated to state that ManagedType must not be escaped and adds a note in the Escaping section.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs Changes ManagedType generation to use Type.FullName and updates GetMethod lookup behavior accordingly.
docs/RFCs/0017-Managed-TestCase-Properties.md Updates the spec to state ManagedType is never escaped and amends the Escaping section.
Comments suppressed due to low confidence (2)

docs/RFCs/0017-Managed-TestCase-Properties.md:145

  • The RFC now states ManagedType must not be escaped, but the Escaping section immediately below still describes escaping generically and the examples show an escaped/quoted “Parsed Type”. Please clarify/update this section (and/or the examples) so it’s unambiguous which fields can be escaped now (e.g., ManagedMethod only, not ManagedType).

This issue also appears on line 133 of the same file.

## Escaping
If an identifier does not conform to identifier naming rules, it gets escaped. An escaped identifier always start and end with a `'`. Note that `ManagedType` is never escaped.

```console
         Type: CleanNamespaceName.SecondLevel.𝐌𝐲 𝘤𝘭𝘢𝘴𝘴 with 𝘢𝘯 𝒊𝒏𝒂𝒄𝒄𝒆𝒔𝒔𝒊𝒃𝒍𝒆 𝙣𝙖𝙢𝙚 🤷‍♀️
       Method: int Sum(int x, int y)
  Parsed Type: CleanNamespaceName.SecondLevel.'𝐌𝐲 𝘤𝘭𝘢𝘴𝘴 with 𝘢𝘯 𝒊𝒏𝒂𝒄𝒄𝒆𝒔𝒔𝒊𝒃𝒍𝒆 𝙣𝙖𝙢𝙚 🤷‍♀️'
Parsed Method: Sum(System.Int32,System.Int32)

         Type: CleanNamespaceName.SecondLevel.Deeply wrong .namespace name.NamespaceA.Class1
       Method: int Method with . in it(int x, int y)
  Parsed Type: CleanNamespaceName.SecondLevel.'Deeply wrong '.'namespace name'.NamespaceA.Class1
Parsed Method: 'Method with . in it'(System.Int32,System.Int32)

docs/RFCs/0017-Managed-TestCase-Properties.md:135

  • Grammar: “An escaped identifier always start and end…” should be “starts and ends…”.
## Escaping
If an identifier does not conform to identifier naming rules, it gets escaped. An escaped identifier always start and end with a `'`. Note that `ManagedType` is never escaped.

Comment on lines 271 to 279
public static MethodBase GetMethod(Assembly assembly, string managedTypeName, string managedMethodName)
{
var parsedManagedTypeName = ReflectionHelpers.ParseEscapedString(managedTypeName);
var type = assembly.GetType(parsedManagedTypeName, throwOnError: false, ignoreCase: false);
var type = assembly.GetType(managedTypeName, throwOnError: false, ignoreCase: false);

if (type == null)
{
string message = string.Format(CultureInfo.CurrentCulture, Resources.Resources.ErrorTypeNotFound, parsedManagedTypeName);
string message = string.Format(CultureInfo.CurrentCulture, Resources.Resources.ErrorTypeNotFound, managedTypeName);
throw new InvalidManagedNameException(message);
}
@Youssef1313

Copy link
Copy Markdown
Member Author

@nohwnd I answered offline. It might be good if you work on summarizing and organizing the info and adding it publicly here.

@nohwnd

nohwnd commented May 29, 2026

Copy link
Copy Markdown
Member

Yeah still need to put that in summary, and decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants